//
//  JsStringCodecManager.h
//  ugcsdk_pure
//
//  Created by Gikki Ares on 2021/10/25.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface JsBase64Manager : NSObject

extern size_t EstimateBas64EncodedDataSize(size_t inDataSize);
extern size_t EstimateBas64DecodedDataSize(size_t inDataSize);

extern bool Base64EncodeData(const void *inInputData, size_t inInputDataSize, char *outOutputData, size_t *ioOutputDataSize, BOOL wrapped);
extern bool Base64DecodeData(const void *inInputData, size_t inInputDataSize, void *ioOutputData, size_t *ioOutputDataSize);


#pragma mark 1 NSString -> NSData
#pragma mark 1.1
+(NSData *)dataFromBase64String:(NSString *)string;
#pragma mark 1.2
+(NSData *)decodeWebSafeBase64ForString:(NSString *)decodeString;

#pragma mark 2 NSData -> NSString
+(NSString *)base64StringFromData:(NSData *)data;
+(NSString *)encodeWebSafeBase64ForData:(NSData *)data;
+(NSString *)encodeWrappedBase64ForData:(NSData *)data;


#pragma mark 3 NSString -> NSString
#pragma mark 3.1 NSString -> Base64String

/**
 *  字符串进行Base64处理
 *  @return Base64处理后的的字符串
 */
+ (NSString *)base64StringFromString:(NSString *)rawString;

/**
 *  字符串进行Base64解密
 *  @return Base64解密后的字符串
 */
+ (NSString *)stringFromBase64String:(NSString *)base64String;

@end

NS_ASSUME_NONNULL_END
